package Entidad;

import java.io.Serializable;
import javax.persistence.*;


@Entity
public class Song implements Serializable {

    @Id
    @Column(name="TITLE",length=250,nullable=false)
    private String title;
    @Column(name="DURATION",nullable=true)
    private Float  duration = null;
    
    @ManyToOne(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST,CascadeType.REMOVE},optional=false)
    @JoinColumn(name = "Artista")
    private Artist artist;
    
    @ManyToOne(fetch=FetchType.EAGER,cascade={CascadeType.PERSIST,CascadeType.REMOVE},optional=false)
    @JoinColumn(name = "Soundtrack")
    private Soundtrack soundtrack;

    public Song() {
    }

    public Song(String title, Float duration, Artist artist, Soundtrack soundtrack) {
        this.title = title;
        this.duration = duration;
        this.artist = artist;
        this.soundtrack = soundtrack;
    }

    public Float getDuration() {
        return duration;
    }

    public void setDuration(Float duration) {
        this.duration = duration;
    }

    public Artist getArtist() {
        return artist;
    }

    public void setArtist(Artist artist) {
        this.artist = artist;
    }

    public Soundtrack getSoundtrack() {
        return soundtrack;
    }

    public void setSoundtrack(Soundtrack soundtrack) {
        this.soundtrack = soundtrack;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
